<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a="http://richfaces.org/a4j" template="/layout/template.xhtml">


	<ui:define name="center">
		<h:form id="login">

			<rich:panel>
				<f:facet name="header">#{messages['user']}</f:facet>
				<h:panelGrid columns="3" rowClasses="prop"
					columnClasses="name,value,validatormsg">
					<h:outputLabel for="user_username">#{messages['user.username']}:</h:outputLabel>
					<h:inputText id="user_username"
						value="#{userController.user.username}">
						<f:validator validatorId="usernameExistenceValidator" />
					</h:inputText>
					<rich:message for="user_username" styleClass="messagesingle"
						errorClass="errormsg" infoClass="infomsg" warnClass="warnmsg"></rich:message>

					<h:outputLabel for="user_password">#{messages['user.password']}:</h:outputLabel>
					<h:inputSecret id="user_password"
						value="#{userController.user.passwordHash}" />
					<rich:message for="user_password" styleClass="messagesingle"
						errorClass="errormsg" infoClass="infomsg" warnClass="warnmsg"></rich:message>

					<h:outputLabel for="rewriteuser_password">#{messages['user.rewrite.password']}:</h:outputLabel>
					<h:inputSecret id="rewriteuser_password">
						<s:validateEquality for="user_password"
							messageId="validateNotSamePassword" operator="equal" />
					</h:inputSecret>
					<rich:message for="rewriteuser_password" styleClass="messagesingle"
						errorClass="errormsg" infoClass="infomsg" warnClass="warnmsg"></rich:message>

					<h:outputLabel for="user_firstname">#{messages['user.firstname']}:</h:outputLabel>
					<h:inputText id="user_firstname"
						value="#{userController.user.firstname}" />
					<rich:message for="user_firstname" styleClass="messagesingle"
						errorClass="errormsg" infoClass="infomsg" warnClass="warnmsg"></rich:message>

					<h:outputLabel for="user_lastname">#{messages['user.lastname']}:</h:outputLabel>
					<h:inputText id="user_lastname"
						value="#{userController.user.lastname}" />
					<rich:message for="user_firstname" styleClass="messagesingle"
						errorClass="errormsg" infoClass="infomsg" warnClass="warnmsg"></rich:message>

					<h:outputLabel for="user_email">#{messages['user.email']}:</h:outputLabel>
					<h:inputText id="user_email" value="#{userController.user.email}">
						<s:validate />
					</h:inputText>
					<rich:message for="emailRegistration" styleClass="messagesingle"
						errorClass="errormsg" infoClass="infomsg" warnClass="warnmsg"></rich:message>
					<h:outputLabel for="user_email">#{messages['user.email']}:</h:outputLabel>
					<h:selectOneMenu id="selectedRole"
						value="#{userController.selectedRole}" required="true"
						requiredMessage="Debe seleccionar uno">
						<s:selectItems var="rol" value="#{userController.roles}"
							label="#{rol.rolename}" noSelectionLabel="----Select---" />
						<s:convertEntity />
					</h:selectOneMenu>
					<rich:message for="selectedRole" styleClass="messagesingle"
						errorClass="errormsg" infoClass="infomsg" warnClass="warnmsg"></rich:message>
				</h:panelGrid>
				
			</rich:panel>

			<div class="actionButtons"><h:commandButton id="registerBtn"
				value="#{messages['general.save']}"
				action="#{userController.saveUser}">
				<s:defaultAction />
			</h:commandButton></div>

		</h:form>


	</ui:define>
</ui:composition>
